/**
 * 
 */
package org.arpit.masteringextjs.utility;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author arpit
 *
 */
public abstract class DateTimeUtility {

	private static final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
	
	public static String toString(Date date){
		return dateFormat.format(date);
	}
	
	public static Date toDate(String dateString){
		try {
			return dateFormat.parse(dateString);
		} catch (ParseException e) {
			return null;
		}
	}
}
